﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CCPnuts.Pack;

namespace CCPnuts.ISkyDiskFileSystem.Interfaces
{
    public delegate void I_TransmissionUpdateEvent();

    /// <summary>
    /// Represent a transmission.
    /// </summary>
    public interface I_Transmitor : IPacked
    {
        #region Essential Methods

        event I_TransmissionUpdateEvent TransmissionUpdate;

        /// <summary>
        /// Begin a Synchronous transmission.
        /// Return till the transmission is finish.
        /// </summary>
        void Run();

        /// <summary>
        /// Stop a transmission.
        /// </summary>
        void Stop();

        /// <summary>
        /// Gets the number of bytes to send.
        /// </summary>
        long TotalToSend { get; }

        /// <summary>
        /// Gets the number of bytes has sent.
        /// </summary>
        long Sent { get; }

        /// <summary>
        /// Gets the speed of the transmission.
        /// </summary>
        int Speed { get; }

        /// <summary>
        /// Gets the state of the transmission.
        /// </summary>
        TransmissionStateTypes TransmissionState { get; }

        #endregion

        #region Optional Members

        /// <summary>
        /// Begin a asynchronous transmission.
        /// </summary>
        /// <returns></returns>
        [Optional]
        IAsyncResult BeginRun(AsyncCallback callback);

        /// <summary>
        /// End a asynchronous transmission.
        /// </summary>
        /// <param name="result"></param>
        [Optional]
        void EndRun(IAsyncResult result);

        /// <summary>
        /// Pause a transmision.
        /// </summary>
        [Optional]
        void Pause();

        /// <summary>
        /// Resume a transmission.
        /// </summary>
        [Optional]
        void Resume();

        #endregion
    }
}
